package com.aiss.ws.activity;

import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.widget.EditText;
import android.widget.TextView;

import com.aiss.ws.Entity.AgreenonItem;
import com.aiss.ws.Entity.CurseItem;
import com.aiss.ws.R;
import com.aiss.ws.utils.Command;
import com.aiss.ws.utils.Futil;
import com.aiss.ws.utils.Url;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Extra;
import org.androidannotations.annotations.ViewById;

import java.util.HashMap;

/**
 * Created by chenqiang on 16/5/17.
 * 补全账号信息
 */
@EActivity(R.layout.activity_addinformation)
public class AddInformationctivity extends BaseActivity {

    @ViewById(R.id.title)
    TextView title_tv;


    private Context context = this;

    private Handler handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            if(msg.what== Command.HANDLECODE19){
                AgreenOnActivity_.intent(context).extra("item",item).extra("agreenonItem",agreenonItem).start();
                finish();
            }

        }
    };

    @Extra
    CurseItem item;

    @ViewById(R.id.name_et)
    EditText name_et;

    @ViewById(R.id.phone_et)
    EditText phone_et;

    @ViewById(R.id.card_et)
    EditText card_et;

    @ViewById(R.id.addr_et)
    EditText addr_et;

    @Extra
    AgreenonItem agreenonItem;



    @Click(R.id.back)
    void setBack(){
        finish();
    }

    @AfterViews
    void init(){
        title_tv.setText("补全真实信息");
    }

    @Click(R.id.sure_button)
    void setSureButton(){
        HashMap<String,String> hashMap = new HashMap<>();
        hashMap.put("type","add");
        hashMap.put("trname",name_et.getText().toString());
        hashMap.put("phone",phone_et.getText().toString());
        hashMap.put("idcard",card_et.getText().toString());
        hashMap.put("addr",addr_et.getText().toString());
        Futil.xutils(Url.INFORMATION,hashMap,handler, Command.HANDLECODE19,context);
    }




}
